package com.huiquan.section.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.section.domain.SectionBlack;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class SectionBlackDao extends EnhancedBaseDao<SectionBlack> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "SECTION_BLACK.";

	public SectionBlackDao() {
		super(space);
	}

	public int retrieveSize(Map<String, Object> param) {
		return (Integer) this.object(space + "RETRIEVE_SIZE", param, sqlMapClient);
	}

	@SuppressWarnings("unchecked")
	public List<SectionBlack> retrievesList(Map<String, Object> param) {
		return (List<SectionBlack>) this.list(space + "RETRIEVE_LIST", param, sqlMapClient);
	}

	
	public void deleteAll() {
		Map<String, Object> param = new HashMap<>();
		update(space + "DELETE_ALL", param, sqlMapClient);
	}
	
	public void batchInsert(List<SectionBlack> labelList) {
		this.insert(space + "BATCH_INSERT", labelList, sqlMapClient);
	}
	
	@SuppressWarnings("unchecked")
	public List<String> checkBlackImageSection() {
		return (List<String>) this.list(space + "CHECK_BLACK_IMAGE_SECTION",  sqlMapClient);
	}
	public void updateNewSection(String oldSectionId,String newSectionId,long userId) {
		Map<String, Object> param = new HashMap<>();
		param.put("oldSectionId", oldSectionId);
		param.put("newSectionId", newSectionId);
		param.put("modifierId", userId);
		update(space + "UPDATE_NEW_SECTION", param, sqlMapClient);
	}
}
